package br.ifrn.edu.helper;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import com.sun.xml.rpc.processor.modeler.j2ee.xml.trueFalseType;

public class Helper {

	public static boolean sessaoValida() {
		HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		try {
			if (session.getAttribute("usuario") != null) {
				return true;
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		return false;
	}
	
	public static Object sessao(String atributo) {
		try {
			return ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute(atributo);			
		} catch (Exception e) {
			// TODO: handle exception
		}
		return null;
	}
	
}
